/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package driver;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.dom.DOMSource;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import xml.XMLHelper;

/**
 *
 * @author keith
 */
public class BoumlDriver {

  static public void main(String[] args) throws FileNotFoundException,
          SAXException, IOException, TransformerConfigurationException,
          ParserConfigurationException, TransformerException {
    File f = new File("config/section_builder.xsl");

    if (f.exists()) {
      System.out.println("Found! ");
      Document xslDoc = XMLHelper.parse(f);
      Transformer transformer = XMLHelper.getTransformer(xslDoc);

      DocumentBuilderFactory docBldFac = DocumentBuilderFactory.newInstance();
      DocumentBuilder docBld = docBldFac.newDocumentBuilder();
      DOMResult result = new DOMResult();
      Source docSrc = new DOMSource(docBld.newDocument());

      transformer.transform(docSrc, result);
      
      XMLHelper.dump( result.getNode() );
    }
  }
}
